package com.pixiv.Entity;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Scope("prototype")
@Component
public class PictureLabel {
    private int labelID;
    private String pictureLabel;
    private String color;

    public int getLabelID() {
        return labelID;
    }

    public void setLabelID(int labelID) {
        this.labelID = labelID;
    }

    public String getPictureLabel() {
        return pictureLabel;
    }

    public void setPictureLabel(String pictureLabel) {
        this.pictureLabel = pictureLabel;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public int getColorRed(){
        if (color != null) {
            int getDoutFrist = color.indexOf(",");
            String num = color.substring(0,getDoutFrist);
            return Integer.valueOf(num);
        }
        return -1;
    }

    public int getColorGreen(){
        if (color != null) {
            int getDoutFrist = color.indexOf(",");
            int getDoutSecond = color.lastIndexOf(",");
            String num = color.substring(getDoutFrist + 1,getDoutSecond);
            return Integer.valueOf(num);
        }
        return -1;
    }

    public int getColorBlue(){
        if (color != null) {
            int getDoutFrist = color.lastIndexOf(",");
            int getDoutSecond = color.length();
            String num = color.substring(getDoutFrist + 1,getDoutSecond);
            return Integer.valueOf(num);
        }
        return -1;
    }

}
